package com.wages.project.system.attence.service.impl;

import java.util.Date;
import java.util.List;
import com.wages.common.utils.DateUtils;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.wages.project.system.attence.mapper.AttenceMapper;
import com.wages.project.system.attence.domain.Attence;
import com.wages.project.system.attence.service.IAttenceService;
import com.wages.common.utils.text.Convert;

/**
 * attenceService业务层处理
 *
 * @author wages
 * @date 2021-05-20
 */
@Service
public class AttenceServiceImpl implements IAttenceService
{
    @Autowired
    private AttenceMapper attenceMapper;

    /**
     * 查询attence
     *
     * @param id attenceID
     * @return attence
     */
    @Override
    public Attence selectAttenceById(Long id)
    {
        return attenceMapper.selectAttenceById(id);
    }

    /**
     * 查询attence列表
     *
     * @param attence attence
     * @return attence
     */
    @Override
    public List<Attence> selectAttenceList(Attence attence)
    {
        return attenceMapper.selectAttenceList(attence);
    }

    /**
     * 新增attence
     *
     * @param attence attence
     * @return 结果
     */
    @Override
    public int insertAttence(Attence attence)
    {
        attence.setCreateTime(DateUtils.getNowDate());
        return attenceMapper.insertAttence(attence);
    }

    /**
     * 修改attence
     *
     * @param attence attence
     * @return 结果
     */
    @Override
    public int updateAttence(Attence attence)
    {
        attence.setUpdateTime(DateUtils.getNowDate());
        return attenceMapper.updateAttence(attence);
    }

    /**
     * 删除attence对象
     *
     * @param ids 需要删除的数据ID
     * @return 结果
     */
    @Override
    public int deleteAttenceByIds(String ids)
    {
        return attenceMapper.deleteAttenceByIds(Convert.toStrArray(ids));
    }

    /**
     * 删除attence信息
     *
     * @param id attenceID
     * @return 结果
     */
    @Override
    public int deleteAttenceById(Long id)
    {
        return attenceMapper.deleteAttenceById(id);
    }

    @Override
    public Attence selectAttenceStatus(Long userId, Date stateTime, Date endTime) {
        return attenceMapper.selectAttenceStatus(userId,  stateTime, endTime);
    }
}
